
package controllers;
import vos.*;
import play.db.jpa.Transactional;
import play.libs.Json;
import sanduche.play.shared.SanController;
import play.mvc.Http.Request;
import play.mvc.Http.Response;
import play.mvc.Http.Session;
import play.mvc.Result;
import models.*;
public class SupadminController extends SanController {
	@Transactional(readOnly=true)
	public static Result getMateriasGrado(Long idGrado, Long idColegio){
		try{
			
			return ok(Json.toJson(sanduche.controllers.SupadminController.getMateriasGrado(idGrado, idColegio)));
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional(readOnly=true)
	public static Result getColegio(Long idColegio){
		try{
			
			return ok(Json.toJson(sanduche.controllers.SupadminController.getColegio(idColegio)));
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional
	public static Result goNext(Long idColegio){
		try{
			
			return ok(Json.toJson(sanduche.controllers.SupadminController.goNext(idColegio)));
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional(readOnly=true)
	public static Result getGradosColegio(Long idColegio){
		try{
			
			return ok(Json.toJson(sanduche.controllers.SupadminController.getGradosColegio(idColegio)));
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional(readOnly=true)
	public static Result getProfesores(Long idColegio){
		try{
			
			return ok(Json.toJson(sanduche.controllers.SupadminController.getProfesores(idColegio)));
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional(readOnly=true)
	public static Result getSecretarios(Long idColegio){
		try{
			
			return ok(Json.toJson(sanduche.controllers.SupadminController.getSecretarios(idColegio)));
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional
	public static Result newProfesor(Long idColegio){
		try{
			Profesor body = Json.fromJson(request().body().asJson(),Profesor.class);
			return ok(Json.toJson(sanduche.controllers.SupadminController.newProfesor(body, idColegio)));
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional
	public static Result newSecretario(Long idColegio){
		try{
			Secretario body = Json.fromJson(request().body().asJson(),Secretario.class);
			return ok(Json.toJson(sanduche.controllers.SupadminController.newSecretario(body, idColegio)));
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional
	public static Result newOrientador(Long idColegio){
		try{
			Orientador body = Json.fromJson(request().body().asJson(),Orientador.class);
			return ok(Json.toJson(sanduche.controllers.SupadminController.newOrientador(body, idColegio)));
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional(readOnly=true)
	public static Result getMateriasColegio(Long idColegio){
		try{
			
			return ok(Json.toJson(sanduche.controllers.SupadminController.getMateriasColegio(idColegio)));
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional(readOnly=true)
	public static Result getColegios(){
		try{
			
			return ok(Json.toJson(sanduche.controllers.SupadminController.getColegios()));
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional
	public static Result newColegio(){
		try{
			Colegio body = Json.fromJson(request().body().asJson(),Colegio.class);
			return ok(Json.toJson(sanduche.controllers.SupadminController.newColegio(body)));
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional
	public static Result updateColegio(Long idColegio){
		try{
			Colegio body = Json.fromJson(request().body().asJson(),Colegio.class);
			sanduche.controllers.SupadminController.updateColegio(body, idColegio);return ok();
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional(readOnly=true)
	public static Result getOrientadores(Long idColegio){
		try{
			
			return ok(Json.toJson(sanduche.controllers.SupadminController.getOrientadores(idColegio)));
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional(readOnly=true)
	public static Result getCoordinadores(Long idColegio){
		try{
			
			return ok(Json.toJson(sanduche.controllers.SupadminController.getCoordinadores(idColegio)));
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional
	public static Result newCoordinador(Long idColegio){
		try{
			Coordinador body = Json.fromJson(request().body().asJson(),Coordinador.class);
			return ok(Json.toJson(sanduche.controllers.SupadminController.newCoordinador(body, idColegio)));
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional
	public static Result newMateriaColegio(){
		try{
			Materia body = Json.fromJson(request().body().asJson(),Materia.class);
			return ok(Json.toJson(sanduche.controllers.SupadminController.newMateriaColegio(body)));
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional
	public static Result newGradoColegio(){
		try{
			Grado body = Json.fromJson(request().body().asJson(),Grado.class);
			return ok(Json.toJson(sanduche.controllers.SupadminController.newGradoColegio(body)));
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional
	public static Result deleteMateriaColegio(Long idMateria, Long idColegio){
		try{
			
			sanduche.controllers.SupadminController.deleteMateriaColegio(idMateria, idColegio);return ok();
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional
	public static Result deleteGradoColegio(Long idGrado, Long idColegio){
		try{
			
			sanduche.controllers.SupadminController.deleteGradoColegio(idGrado, idColegio);return ok();
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional(readOnly=true)
	public static Result getGrado(Long idGrado){
		try{
			
			return ok(Json.toJson(sanduche.controllers.SupadminController.getGrado(idGrado)));
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional(readOnly=true)
	public static Result getMateria(Long idMateria){
		try{
			
			return ok(Json.toJson(sanduche.controllers.SupadminController.getMateria(idMateria)));
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional
	public static Result updateGrado(Long idGrado){
		try{
			Grado body = Json.fromJson(request().body().asJson(),Grado.class);
			sanduche.controllers.SupadminController.updateGrado(body, idGrado);return ok();
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional
	public static Result updateMateria(Long idMateria){
		try{
			Materia body = Json.fromJson(request().body().asJson(),Materia.class);
			sanduche.controllers.SupadminController.updateMateria(body, idMateria);return ok();
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional
	public static Result newMateriaGrado(){
		try{
			MateriaGrado body = Json.fromJson(request().body().asJson(),MateriaGrado.class);
			return ok(Json.toJson(sanduche.controllers.SupadminController.newMateriaGrado(body)));
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional
	public static Result deleteMateriaGrado(Long idMateria, Long idGrado, Long idColegio){
		try{
			
			sanduche.controllers.SupadminController.deleteMateriaGrado(idMateria, idGrado, idColegio);return ok();
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional
	public static Result getEscalaNotas(Long idColegio){
		try{
			
			return ok(Json.toJson(sanduche.controllers.SupadminController.getEscalaNotas(idColegio)));
		}catch(Throwable e){return parseError(e);}
	}
 
	@Transactional
	public static Result setEscalaNotas(Long idColegio){
		try{
			EscalaNotas body = Json.fromJson(request().body().asJson(),EscalaNotas.class);
			return ok(Json.toJson(sanduche.controllers.SupadminController.setEscalaNotas(body, idColegio)));
		}catch(Throwable e){return parseError(e);}
	}
}